{% extends "base.html" %}
{% load bootstrap3 %}

{% block title %}Inloggen{% endblock %}

{% block content %}
<div class="container">
  <div class="row">
    <div class="col-sm-offset-2 col-sm-10">
      <h2>Inloggen</h2>
      <p>Niet geregistreerd?  
        <a href="{% url 'registration_register' %}">Nu registreren</a></p>
      <p>Problemen met inloggen?  
        <a href="{% url 'django.contrib.auth.views.password_reset' %}">Wachtwoord resetten.</a></p>
    </div>
  </div>

  {% if form.errors %}
  <div class="row">
    <div class="alert alert-danger col-sm-offset-2 col-sm-6">
      <p><strong>Login niet gelukt. Probeer opnieuw...</strong></p>
    </div>
  </div>
  {% endif %}

  <form action="{% url 'django.contrib.auth.views.login' %}" 
      method="post" 
      role="form" 
      class="form-horizontal">
    {% csrf_token %}

    {% bootstrap_field form.username layout='horizontal' %}
    {% bootstrap_field form.password layout='horizontal' %}
    {% if next %}
      <input type="hidden" name="next" value="{{ next }}" />
    {% else %}
      <input type="hidden" name="next" value="{% url 'home' %}" />
    {% endif %}
    {% buttons %}
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary">
        Login
      </button>
    </div>
    {% endbuttons %}
  </form>

</div>
{% endblock %}
